import React, { Component } from 'react'

export default class Item extends Component {
  render() {
    // console.log(this.props)
    const { id, completed, title, change, click } = this.props
    return (
      <li className="list-group-item">
        <div className="checkbox">
          <label>
            <input
              type="checkbox"
              checked={completed}
              onChange={() => change(id, completed)}
            />
            {title}----- {completed ? '已完成' : '未完成'}
          </label>

          <button
            onClick={() => click(id)}
            type="button"
            className="btn btn-danger pull-right"
          >
            删除
          </button>
        </div>
      </li>
    )
  }
}
